package com.ruowei.modules.member.domain;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import javax.persistence.*;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.Instant;

/**
 * 小程序用户信息表
 */
@ApiModel(description = "小程序用户信息表")
@Entity
@Table(name = "jhi_member")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Member implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 小程序用户openId
     */
    @ApiModelProperty(value = "小程序用户openId")
    @Column(name = "open_id")
    private String openId;

    /**
     * 小程序用户临时token
     */
    @ApiModelProperty(value = "小程序用户临时token")
    @Column(name = "applet_token")
    private String appletToken;

    /**
     * 小程序用户sessionKey
     */
    @ApiModelProperty(value = "小程序用户sessionKey")
    @Column(name = "session_key")
    private String sessionKey;

    /**
     * 手机号
     */
    @ApiModelProperty(value = "手机号")
    @Column(name = "phone")
    private String phone;

    /**
     * 用户姓名
     */
    @ApiModelProperty(value = "用户姓名")
    @Column(name = "name")
    private String name;

    /**
     * 昵称
     */
    @ApiModelProperty(value = "昵称")
    @Column(name = "nickname")
    private String nickname;

    /**
     * 用户类型
     */
    @ApiModelProperty(value = "用户类型")
    @Column(name = "user_type")
    private String userType;

    /**
     * 创建时间
     */
    @ApiModelProperty(value = "创建时间")
    @Column(name = "create_time")
    private Instant createTime;

    /**
     * 头像
     */
    @ApiModelProperty(value = "头像")
    @Column(name = "photo")
    private String photo;

    /**
     * 更新时间
     */
    @ApiModelProperty(value = "更新时间")
    @Column(name = "update_time")
    private Instant updateTime;

    /**
     * 可用积分数
     */
    @ApiModelProperty(value = "可用积分数")
    @Column(name = "available_points")
    private Integer availablePoints;

    /**
     * 成长值
     */
    @ApiModelProperty(value = "成长值")
    @Column(name = "growth")
    private Integer growth;

    /**
     * 历史积分数
     */
    @ApiModelProperty(value = "历史积分数")
    @Column(name = "history_points")
    private Integer historyPoints;

    /**
     * 累计消费金额
     */
    @ApiModelProperty(value = "累计消费金额")
    @Column(name = "total_consumption", precision = 21, scale = 2)
    private BigDecimal totalConsumption;

    /**
     * 等级
     */
    @ApiModelProperty(value = "等级")
    @Column(name = "jhi_level")
    private Integer level;

    // jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getOpenId() {
        return openId;
    }

    public Member openId(String openId) {
        this.openId = openId;
        return this;
    }

    public void setOpenId(String openId) {
        this.openId = openId;
    }

    public String getAppletToken() {
        return appletToken;
    }

    public void setAppletToken(String appletToken) {
        this.appletToken = appletToken;
    }

    public String getSessionKey() {
        return sessionKey;
    }

    public Member sessionKey(String sessionKey) {
        this.sessionKey = sessionKey;
        return this;
    }

    public void setSessionKey(String sessionKey) {
        this.sessionKey = sessionKey;
    }

    public String getPhone() {
        return phone;
    }

    public Member phone(String phone) {
        this.phone = phone;
        return this;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getName() {
        return name;
    }

    public Member name(String name) {
        this.name = name;
        return this;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getNickname() {
        return nickname;
    }

    public Member nickname(String nickname) {
        this.nickname = nickname;
        return this;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public String getUserType() {
        return userType;
    }

    public Member userType(String userType) {
        this.userType = userType;
        return this;
    }

    public void setUserType(String userType) {
        this.userType = userType;
    }

    public Instant getCreateTime() {
        return createTime;
    }

    public Member createTime(Instant createTime) {
        this.createTime = createTime;
        return this;
    }

    public void setCreateTime(Instant createTime) {
        this.createTime = createTime;
    }

    public String getPhoto() {
        return photo;
    }

    public Member photo(String photo) {
        this.photo = photo;
        return this;
    }

    public void setPhoto(String photo) {
        this.photo = photo;
    }

    public Instant getUpdateTime() {
        return updateTime;
    }

    public Member updateTime(Instant updateTime) {
        this.updateTime = updateTime;
        return this;
    }

    public void setUpdateTime(Instant updateTime) {
        this.updateTime = updateTime;
    }

    public Integer getAvailablePoints() {
        return availablePoints;
    }

    public Member availablePoints(Integer availablePoints) {
        this.availablePoints = availablePoints;
        return this;
    }

    public void setAvailablePoints(Integer availablePoints) {
        this.availablePoints = availablePoints;
    }

    public Integer getGrowth() {
        return growth;
    }

    public Member growth(Integer growth) {
        this.growth = growth;
        return this;
    }

    public void setGrowth(Integer growth) {
        this.growth = growth;
    }

    public Integer getHistoryPoints() {
        return historyPoints;
    }

    public Member historyPoints(Integer historyPoints) {
        this.historyPoints = historyPoints;
        return this;
    }

    public void setHistoryPoints(Integer historyPoints) {
        this.historyPoints = historyPoints;
    }

    public BigDecimal getTotalConsumption() {
        return totalConsumption;
    }

    public Member totalConsumption(BigDecimal totalConsumption) {
        this.totalConsumption = totalConsumption;
        return this;
    }

    public void setTotalConsumption(BigDecimal totalConsumption) {
        this.totalConsumption = totalConsumption;
    }

    public Integer getLevel() {
        return level;
    }

    public Member level(Integer level) {
        this.level = level;
        return this;
    }

    public void setLevel(Integer level) {
        this.level = level;
    }
    // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof Member)) {
            return false;
        }
        return id != null && id.equals(((Member) o).id);
    }

    @Override
    public int hashCode() {
        return 31;
    }

    @Override
    public String toString() {
        return "Member{" +
            "id=" + getId() +
            ", openId='" + getOpenId() + "'" +
            ", sessionKey='" + getSessionKey() + "'" +
            ", phone='" + getPhone() + "'" +
            ", name='" + getName() + "'" +
            ", nickname='" + getNickname() + "'" +
            ", userType='" + getUserType() + "'" +
            ", createTime='" + getCreateTime() + "'" +
            ", photo='" + getPhoto() + "'" +
            ", updateTime='" + getUpdateTime() + "'" +
            ", availablePoints=" + getAvailablePoints() +
            ", growth=" + getGrowth() +
            ", historyPoints=" + getHistoryPoints() +
            ", totalConsumption=" + getTotalConsumption() +
            ", level=" + getLevel() +
            "}";
    }
}
